package cn.com.qqgame.assistant;

public class Runner {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if(args.length == 0) {
			System.err.println("Parameter is required.");
			return;
		}
		try {
			final Object object = Class.forName(args[0]).newInstance();
			if(object instanceof Assistant) {
				System.out.println(String.format("Running assistant: %s...", object.getClass().getName()));
				((Assistant) object).run();
			} else {
				System.err.println("Invalid parameter.");
			}
		} catch (InstantiationException e) {
			e.printStackTrace(System.err);
		} catch (IllegalAccessException e) {
			e.printStackTrace(System.err);
		} catch (ClassNotFoundException e) {
			e.printStackTrace(System.err);
		}
	}
}
